package org.liuyunfeng.web;

import org.liuyunfeng.domain.NewUser;
import org.liuyunfeng.domain.UserMapper;
import org.liuyunfeng.service.NewUserService;
import org.liuyunfeng.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * @description:
 * @author: TanJingyu
 * @create: 2022-03-02 18:23
 **/
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService service;
    @Autowired
    private NewUserService newUserService;


    @GetMapping("/getNewUser")
    public Object getNewUser() throws InterruptedException {
        newUserService.selectNewUser();
        return "success";
    }

    @GetMapping("/updateNewUser")
    public Object updateNewUser() throws InterruptedException {
        try {
            newUserService.updateNewUser();
        }catch (Exception e) {
            System.out.println(e.getLocalizedMessage());
        }
        return "success";
    }

    @GetMapping
    public Boolean deleteUser(Integer id) {
        service.deleteUser(id);
        return true;
    }
}

    